﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TrustDistrictsListFrame.ascx.cs"
    Inherits="AB.ServiceDirectory.Design.WebUserControls.Frame.TrustDistrictsListFrame" %>
<%@ Import Namespace="AB.ServiceDirectory" %>
<script type="text/javascript">
    function Confirm_Active() {
        return confirm('Do you want to make this Trust District active ?');
    }
</script>
<asp:UpdatePanel runat="server" ID="UpdatePanelTrustDistrictsList">
    <ContentTemplate>
        <div class="titleh">
            <h3 class="sorting_range">
                <asp:LinkButton ID="LinkButtonAll" runat="server" OnCommand="FilterByLetters_Command"
                    CommandName="all" ClientIDMode="Static" CssClass="hg-blue">All</asp:LinkButton>
                <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">0-9</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">A B C D E</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">F G H I J</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">K L M N </asp:LinkButton>
                <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">O P Q R</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonSV" runat="server" CommandName="sv" OnCommand="FilterByLetters_Command"
                    ClientIDMode="Static">S T U V</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonWZ" CssClass="last" runat="server" CommandName="wz"
                    OnCommand="FilterByLetters_Command" ClientIDMode="Static">W X Y Z</asp:LinkButton>
                <span class="right">
                    <asp:LinkButton ID="LinkButtonCreate" runat="server" CssClass="hg-blue" OnClick="LinkButtonCreate_Click">Create</asp:LinkButton>
                    <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                        OnCheckedChanged="CheckBoxInactive_CheckedChanged" />
                </span>
            </h3>
        </div>
        <asp:GridView ID="GridViewDistrictList" runat="server" CssClass="tablesorter" AutoGenerateColumns="False"
            DataSourceID="ObjectDataSourceTrustDistrictsList" AllowPaging="True" PageSize="15"
            AllowSorting="True" EmptyDataText="There is no item in the list">
            <Columns>
                <asp:TemplateField HeaderText="Trust District Name" SortExpression="TrustDistrictName">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButtonTrustDistrictName" CausesValidation="false" runat="server"
                            CommandName='<%# Eval("TrustDistrictId") %>' CommandArgument='<%#Eval("IsActive") %>'
                            OnClientClick='<%# !(bool)Eval("IsActive") ? "return Confirm_Active();" : string.Empty %>'
                            OnCommand="LinkButtonTrustDistrictName_Command"><%# Eval("TrustDistrictName")%></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" />
                    <ItemStyle Width="150px" />
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Description" SortExpression="Description">
                    <ItemTemplate>
                        <%# StringTools.Substring(Eval("Description"), 0, 50, true) %>
                    </ItemTemplate>
                    <ItemStyle Width="340px" />
                    <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Region" SortExpression="TrustRegionName">
                    <ItemTemplate>
                        <%#Eval("TrustRegion.TrustRegionName")%>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                    <HeaderStyle CssClass="header" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Is Active?" SortExpression="IsActive">
                    <ItemTemplate>
                        <%#(bool) Eval("IsActive") ? "Yes" :"No" %>
                    </ItemTemplate>
                    <ItemStyle Width="88px" />
                    <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <blockquote>
                    There are no items to show.</blockquote>
            </EmptyDataTemplate>
            <PagerStyle CssClass="pagination_table"></PagerStyle>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:ObjectDataSource ID="ObjectDataSourceTrustDistrictsList" runat="server" TypeName="AB.ServiceDirectory.BO.TrustDistrictsBO"
    SelectMethod="GetTrustDistrict" OnSelecting="ObjectDataSourceTrustDistrict_Selecting"
    EnablePaging="True" SelectCountMethod="GetTrustDistrictCount" StartRowIndexParameterName="startRowIndex"
    MaximumRowsParameterName="maxRows" SortParameterName="sortType">
    <SelectParameters>
        <asp:Parameter Name="filter" Type="Object" ConvertEmptyStringToNull="False" />
    </SelectParameters>
</asp:ObjectDataSource>